/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yunhoo.checkFlow.db.impl;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.template.SqlMapDaoTemplate;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.yunhoo.checkFlow.db.dao.FlowInfoDao;
import com.yunhoo.checkFlow.model.FlowInfo;
import com.yunhoo.sys.db.util.DbTool;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrator
 */
public class FlowInfoDaoImpl extends SqlMapDaoTemplate implements FlowInfoDao {

    private static SqlMapClient sqlmap;
    private String nameSpace = "flowInfo.";

    public FlowInfoDaoImpl(DaoManager daoManager) {
        super(daoManager);
        sqlmap = DbTool.getSqlMapClient();
    }

    @Override
    public Integer queryMaxNumber(FlowInfo flowInfo) {
        System.out.println(nameSpace + "queryMaxNumber");
        try {
            return (Integer) sqlmap.queryForObject(nameSpace + "queryMaxNumber", flowInfo);
        } catch (SQLException ex) {
            Logger.getLogger(FlowInfoDaoImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    @Override
    public List<FlowInfo> queryFlowInfoByNumberAndType(FlowInfo flowInfo) {
        System.out.println(nameSpace + "queryFlowInfoByNumberAndType");
        try {
            return sqlmap.queryForList(nameSpace + "queryFlowInfoByNumberAndType", flowInfo);
        } catch (SQLException ex) {
            Logger.getLogger(FlowInfoDaoImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }

    @Override
    public void insertFlowInfo(FlowInfo flowInfo) throws SQLException {
        System.out.println(nameSpace + "insertFlowInfo");
        sqlmap.insert(nameSpace + "insertFlowInfo", flowInfo);
    }

    @Override
    public void deleteFlowInfoByNumber(FlowInfo flowInfo) throws SQLException {
        System.out.println(nameSpace + "deleteFlowInfoByNumber");
        sqlmap.delete(nameSpace + "deleteFlowInfoByNumber", flowInfo);
    }
}
